<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of AddForm
 *
 * @author Admin
 */
class Application_Form_house_AddForm extends Zend_Form {

    public function __construct($options = null) {
        parent::__construct($options);

        $officialAddress = new Zend_Form_Element_Text('officialAddress');
        $officialAddress->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $address = new Zend_Form_Element_Text('address');
        $address->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $postnr = new Zend_Form_Element_Text('postnr');
        $postnr->addFilter('StripTags')
                ->addFilter('StringTrim')
    //            ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $postadress = new Zend_Form_Element_Text('postadress');
        $postadress->addFilter('StripTags')
                ->addFilter('StringTrim')
   //             ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $ownerName = new Zend_Form_Element_Text('ownerName');
        $ownerName->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $customerCode = new Zend_Form_Element_Text('customerCode');
        $customerCode->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $seller = new Zend_Form_Element_Text('seller');
        $seller->addFilter('StripTags')
                ->addFilter('StringTrim')
     //           ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $personalNo = new Zend_Form_Element_Text('personalNo');
        $personalNo->addFilter('StripTags')
                ->addFilter('StringTrim')
    //            ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $tel1 = new Zend_Form_Element_Text('tel1');
        $tel1->addFilter('StripTags')
                ->addFilter('StringTrim')
     //           ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $tel2 = new Zend_Form_Element_Text('tel2');
        $tel2->addFilter('StripTags')
                ->addFilter('StringTrim')
      //          ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $email = new Zend_Form_Element_Text('email');
        $email->addFilter('StripTags')
                ->addFilter('StringTrim')
     //           ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));
        

        $regDate = new Zend_Form_Element_Text('regDate');
        $regDate->addFilter('StripTags')
                ->addFilter('StringTrim')
     //           ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $avropad = new Zend_Form_Element_Text('avropad');
        $avropad->addFilter('StripTags')
                ->addFilter('StringTrim')
     //           ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $blastKlar = new Zend_Form_Element_Text('blastKlar');
        $blastKlar->addFilter('StripTags')
                ->addFilter('StringTrim')
     //           ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $aviseradVecka = new Zend_Form_Element_Text('aviseradVecka');
        $aviseradVecka->addFilter('StripTags')
                ->addFilter('StringTrim')
      //          ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $installKlar = new Zend_Form_Element_Text('installKlar');
        $installKlar->addFilter('StripTags')
                ->addFilter('StringTrim')
      //          ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $installeradAv = new Zend_Form_Element_Text('installeradAv');
        $installeradAv->addFilter('StripTags')
                ->addFilter('StringTrim')
     //           ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $cabinetModel = new Application_Model_CabinetModel();
        $cabinetDetails = $cabinetModel->fetchAll("status = 'Active'");

        $cabinetList = new Zend_Form_Element_Select('cabinetList');
        $cabinetList->setSeparator("")
                ->setAttrib('class', 'select ui-corner-all');
        foreach ($cabinetDetails as $items) {
            $cabinetList->addMultiOption($items->id, $items->name);
        }
        $cabinetList->setDecorators(array('ViewHelper', 'Errors'));

        $switchModel = new Application_Model_SwitchModel();
        $switchDetails = $switchModel->fetchAll("status = 'Active'");

        $switchList = new Zend_Form_Element_Select('switchList');
        $switchList->setSeparator("")
                ->setAttrib('class', 'select ui-corner-all');
        foreach ($switchDetails as $items) {
            $switchList->addMultiOption($items->id, $items->name);
        }
        $switchList->setDecorators(array('ViewHelper', 'Errors'));

        $status = new Zend_Form_Element_Select('status');
        $status->addMultiOption('active', ' Active')
                ->addMultiOption('inactive', ' Inactive')
                ->setSeparator("")
                ->setValue('active')
                ->setAttrib('class', 'select ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $this->addElements(array($officialAddress, $address, $ownerName, $customerCode, $cabinetList, $switchList, $status,$seller,$personalNo,$tel1,$tel2,$email,$regDate,$avropad,$aviseradVecka,$blastKlar,$installKlar,$installeradAv,$postnr,$postadress));
    }

}